﻿@using E5_KhuyenMaiVang.Models;
@model IEnumerable<COMMENT>
@{
    ViewBag.Title = "BinhLuan";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
    var deals = ViewBag.Deals;
    int nComment = Model.Count();
}
@section menu
{
    <h3>Admin</h3>
    <ul class="nav">       
        
   </ul>
}


<div class="top-bar">
    <a href="#" class="button">ADD NEW </a>
    <h1>BÌNH LUẬN</h1>
    <div class="breadcrumbs"><a href="#">Bình luận</a></div>
</div>
<form method="post" action="@Url.Action("SearchBinhLuan", "Admin")">
<div class="select-bar">
        <label>
<select name="DealID">
<option value="0">Tất cả</option>
@foreach (var item in deals)
{
    if (item.DealID != ViewBag.SelectedDeal)
{
<option value="@item.DealID">@item.DealName</option>
}
else { 
    <option value="@item.DealID" selected="true">@item.DealName</option>
}
}
</select>
</label>
    <label>
        <input type="submit" name="Submit" value="Search" />
    </label>
</div>
</form>
<div class="table">
    <table class="listing" cellpadding="0" cellspacing="0">
        <tr>
            <th>Số thứ tự</th>
            <th>Tên khuyến mãi</th>
            <th>Tên người đăng</th>
            
            <th>Ngày đăng</th>
            <th>Nội dung</th>
            <th>Xóa</th>
                            
        </tr>
        @for (int i = 0; i < nComment; i++)
        {
            COMMENT comment = Model.ElementAt(i);
        <tr>
            <td class="style1">@(i+1)</td>
            <td>@comment.DEAL.DealName</td>
            <td>@comment.PostName</td>
            
            <td>@comment.PostDate</td>
            <td>@comment.Text</td>
            <td><a href="@Url.Action("DeleteBinhLuan", "Admin", new { MemberID = @comment.CommentID })" style="text-decoration:none;"><img src="../Images/hr.gif" width="16" height="16" alt="" /></a></td>
                           
                            
        </tr>
        }
                        
    </table>
                    
</div>
<form action="PostComment" method="post">
<div class="table">
    <table class="listing form" cellpadding="0" cellspacing="0">
        <tr>
            <th class="full" colspan="2">ĐĂNG KHUYẾN MÃI</th>
        </tr>
        <tr>
            <td width="172"><strong>Tên người đăng</strong></td>
            <td><input type="text" name="Name" class="text" /></td>
        </tr>
        <tr>
            <td><strong>Email</strong></td>
            <td><input type="text" name = "Email" class="text" /></td>
        </tr>
        <tr>
            <td><strong>Nội dung</strong></td>
            <td><textarea name="Content" id="textarea2" cols="45" rows="5"></textarea></td>
        </tr>
        <input name="dealID" type="hidden" value="@ViewBag.SelectedDeal" /> 
        <tr>
            <td>&nbsp;</td>
            <td><input type="submit" value="Đăng" /></td>
        </tr>
        
    </table>
</div>
 </form>
          